import axios from 'axios'

const service = axios.create({
    baseURL: process.env.VUE_APP_OLED_CONTROL,
    timeout: 3000,
})

service.interceptors.request.use(config => {
    if(/get/i.test(config.method)) {
        config.params = config.params || {}
        config.params.t = Date.parse(new Date())
    }
    return config
})

export function inputChange(input) {
    return service({
        url: "InputChange",
        method: "get",
        params: input
    })
}

export function inputClear() {
    return service({
        url: "InputClear",
        method: "get",
    })
}

export function inputSubmit() {
    return service({
        url: "InputSubmit",
        method: 'get'
    })
}

